home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-09-14 | 1.8 KB | 84 lines | [TEXT/MPS ] |
- #
- # File: CancelWindowCheckOut
- #
- # Contains: script to revert to an old copy of a checked-out window
- #
- # Usage: CancelWindowCheckOut window
- #
- # Status: CancelWindowCheckOut may return the following status values:
- #
- # 0 the window was reverted
- # 1 error
- # 2 the user canceled
- #
- # CancelWindowCheckOut cancels the changes that have been made
- # to a file in a window.
- #
- # Written by: Darin Adler and scott douglass
- #
- # Copyright: © 1988, 1989 by Apple Computer, Inc., all rights reserved.
- #
- # Change History:
- #
- # 11/9/89 dba twiddled relentlessly
- #
- # To Do:
- # a way to start over (get a new modifiable copy)
- # a way to start over but make it a new branch
- #
-
- Set Exit 0
-
- # the following helps to debug until MPW sends echos to Dev:Console instead of Dev:StdErr
-
- If {Echo}
- Set somewhere "∑∑ '{Worksheet}'"
- Else
- Set somewhere "∑ Dev:Null"
- End
-
- Begin
-
- Set Window "{1}"
-
- # get short name of window
-
- If "{Window}" !~ /:*([¬:]+:*)*([¬:]+)®1/
- Alert "Can’t parse window parameter."
- Exit 1
- End
- Set Short "{®1}" # get short name for dialogs
- Set Cant "Changes to “{Short}” can’t be discarded"
-
- # check what project the window belongs to
-
- Set Info "`ProjectInfo "{Window}"`"
- If "{Info}" !~ /≈Project: (≈∫)®1 Checked out: ≈/
- Alert "{Cant} because it doesn’t belong to a project."
- Exit 1
- End
- Set Project "{®1}"
-
- # ensure that the window is checked out
-
- If "{Info}" !~ /[¬,]+,[¬ ∂t]+∂+≈/
- Alert "{Cant} because it wasn’t checked out."
- Exit 1
- End
-
- # check if the project is mounted
-
- Set Info "`ProjectInfo -only -project "{Project}"; Set InfoStatus {Status}`"
- If {InfoStatus}
- Alert "{Cant} because the project “{Project}” is not mounted."
- Exit 1
- End
-
- CheckOut -project "{Project}" -cancel "{Window}"
- If {Status}
- Alert "I confused: CheckOut -cancel failed!"
- Exit 1
- End
-
- End {somewhere}
-